import { appConfig } from 'appConfig.js';
export function req(url, method, params, success, fail) {
  wx.showLoading({
    title: "拼命加载中...",
  })
  wx.request({
    url: appConfig() + url,
    method: method,
    data: params,
    dataType: "json",
    header: {
      'content-type': 'application/x-www-form-urlencoded'
    },
    success: (res) => {
      wx.hideLoading()
      if (res.statusCode == 200) {
        success(res.data);
      } else {
        fail();
      }
    },
    fail: (res) => {
      wx.hideLoading()
      fail();
    },
    complete: function (res) {

    }
  })
}
module.exports = { req: req }